package l.l.w.practice.交错01串;

import java.util.Scanner;

/**
 * Created by llw on 2017/10/8.
 */
public class 交错01串 {

    public int maxLength(String str){
        if(str.length() ==0) return 0;
        if(str.length() == 1) return 1;
        int maxLen = 0;
        int len = 1;
        char pre = str.charAt(0);
        for(int i = 1; i < str.length(); ++i){
            char curr = str.charAt(i);
            if(curr == pre){
                if(len > maxLen) {
                    maxLen = len;
                }
                len =1;
            }else{
                len ++;
            }
            pre = curr;
        }
        if(len > maxLen) {
            maxLen = len;
        }
        return maxLen;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int result = new 交错01串().maxLength(str);
        System.out.println(result);

    }
}
